import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false

// 注册一个全局自定义指令 `v-imgErr`
import imgErr from '@/directive/imgErr'
Vue.directive('imgErr', imgErr)

// 引入自定义全局组建
import Component from '@/components/index'
Vue.use(Component)

// 引入自定义全局方法 过滤器
import * as myFilters from '@/filters'
for (const key in myFilters) {
  // 遍历注册这个文件的所有方法
  Vue.filter(key, myFilters[key])
}

import mixin from '@/mixin'
// 注册mixin
Vue.mixin(mixin)

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
